package com.qqt.csr.im.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qqt.csr.im.dto.SensitiveWordCountDTO;
import com.qqt.csr.im.dto.SensitiveWordRefreshDTO;
import com.qqt.csr.im.entity.SensitiveWord;

import java.util.Date;
import java.util.List;

import com.qqt.csr.im.vo.req.QueryingSensitiveWordReqVO;
import org.apache.ibatis.annotations.Param;

public interface SensitiveWordMapper extends BaseMapper<SensitiveWord> {
    int updateBatch(@Param("list") List<SensitiveWord> list);

    int updateBatchSelective(@Param("list") List<SensitiveWord> list);

    int batchInsert(@Param("list") List<SensitiveWord> list);

    /**
     * 分页查询
     *
     * @param page  分页对象
     * @param query 查询对象
     * @return 分页数据
     */
    IPage<SensitiveWord> page(IPage<SensitiveWord> page, @Param("query") QueryingSensitiveWordReqVO query);

    /**
     * 统计词库的敏感词数量
     *
     * @param repoIds
     * @return
     */
    List<SensitiveWordCountDTO> countByRepoIds(@Param("repoIds") List<Long> repoIds, @Param("tenantId") String tenantId);

    /**
     * 获取敏感词列表用于敏感词拦截
     *
     * @param lastId
     * @param size
     * @return
     */
    List<SensitiveWord> getWordListForDeny(@Param("tenantId") String tenantId, @Param("lastId") Long lastId, @Param("size") Integer size);

    /**
     * 获取敏感词列表用于敏感词刷新
     * @param swUpdateTime
     * @param size
     * @return
     */
    List<SensitiveWordRefreshDTO> getWordListForRefresh(@Param("swUpdateTime") Date swUpdateTime,@Param("pageIndex")  Integer pageIndex, @Param("size") Integer size);

    /**
     * 获取敏感词列表用于敏感词拦截
     *
     * @param name
     * @return
     */
    List<SensitiveWord> getWorldListForTag(@Param("name") String name);

    /**
     * 获取所有租户id
     * @return
     */
    List<String> getAllTenantIdList();
}